/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.sigawe.SIASDIT.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import net.sigawe.SIASDIT.dao.interfc.IOutbox;
import net.sigawe.SIASDIT.dao.model.Message;


/**
 *
 * @author yoze
 */
public class OutboxDAO implements IOutbox{
    
    private Connection connection;

    public OutboxDAO(Connection connection) {
        this.connection = connection;
    }

    public void insert(Message message) throws SQLException {
        
        String sql = "INSERT INTO outbox (Receiver,Text) VALUES (?,?)";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1, message.getPhoneNumber());
        ps.setString(2, message.getText());
        ps.executeUpdate();
    }

}
